const path = require('path')
const ysResolve = (dir) => path.join(__dirname, '../../', dir)
module.exports = {
  base: '/',
  theme: 'antdocs',
  title: 'XUI',
  description: 'YS-UI',
  port: 2000,
  dest: path.resolve(__dirname, '../dist'),
  head: [
    ['link', { rel: 'icon', href: '/assets/favicon.ico' }],
    ['script', {}, 'window.global = window']

  ],
  themeConfig: {
    smoothScroll: true,
    lastUpdated: 'Last Updated', // string | boolean
    logo: '/assets/logo.png',
    nav: [
      { text: 'Home', link: '/' },
      { text: '组件', link: '/guide/' },
      { text: 'Icon', link: '/guide/components/icon-list' },
      { text: '更新日志', link: '/CHANGELOG.md' }
    ],
    sidebar: {
      '/guide/': [{
        title: '安装',
        path: '/guide/' // 可选的, 标题的跳转链接，应为绝对路径且必须存在]
      },
      {
        title: '组件',
        collapsable: false,
        sidebarDepth: 2,
        children: [
          {
            title: 'Card',
            path: '/guide/components/card'
          },
          {
            title: 'Row/Col',
            path: '/guide/components/row'
          },
          {
            title: 'DownloadBtn',
            path: '/guide/components/download-btn'
          },
          {
            title: 'LineTabs',
            path: '/guide/components/line-tabs'
          },
          {
            title: 'SelectTabs',
            path: '/guide/components/select-tabs'
          },
          {
            title: 'Indicator',
            path: '/guide/components/indicator'
          },
          {
            title: 'Tooltip',
            path: '/guide/components/tooltip'
          }, {
            title: 'label',
            path: '/guide/components/label'
          }, {
            title: 'Table',
            path: '/guide/components/table'
          }, {
            title: 'Filtrate',
            path: '/guide/components/filtrate'
          }, {
            title: 'ChartIndictor',
            path: '/guide/components/chart-indicator'
          }, {
            title: 'Funnel',
            path: '/guide/components/funnel'
          }, {
            title: 'KeepTable',
            path: '/guide/components/keep-table'
          },
          {
            title: 'Icon',
            path: '/guide/components/icon-list' // 可选的, 标题的跳转链接，应为绝对路径且必须存在]
          }
        ]
      },
      {
        title: '图表',
        children: [{
          title: 'NormalChart',
          path: '/guide/components/normal-chart'
        }, {
          title: 'MapsChart',
          path: '/guide/components/maps-chart'
        }, {
          title: 'FunnelChart',
          path: '/guide/components/funnel-chart'
        }, {
          title: 'PieChart',
          path: '/guide/components/pie-chart'
        }]
      },
      {
        title: '公用方法',
        collapsable: false,
        sidebarDepth: 2,
        children: [
          {
            title: 'getMaps',
            path: '/guide/methods/getMaps'
          },
          {
            title: '获取统一返回数据',
            path: '/guide/methods/getComMethods'
          },
          {
            title: '请求方式',
            path: '/guide/methods/reqMethods'
          },
          {
            title: '处理数据',
            path: '/guide/methods/disposeRes'
          }
        ]
      }
      ],
      '/share/': [{
        title: 'Git常用命令',
        path: '/share/git'
      }]
    }
  },
  plugins: [
    [
      require('./DomeBlock'),
      {
        component: 'DemoBlock',
        locales: [
          {
            'lang': 'zh-CN',
            'demo-block': {
              'hide-text': '隐藏',
              'show-text': '显示',
              'copy-text': '复制',
              'copy-success': '成功'
            }
          },
          {
            'lang': 'en-US',
            'demo-block': {
              'hide-text': 'Hide',
              'show-text': 'Expand',
              'copy-text': 'Copy',
              'copy-success': 'Successful'
            }
          }
        ]
      }
    ]
  ],
  configureWebpack: {
    resolve: {
      alias: {
        '@assets': path.resolve(__dirname, './public/assets'),
        // ys 目录
        'vue$': 'vue/dist/vue.esm.js',
        '@': ysResolve('examples'),
        'packages': ysResolve('packages'),
        'mixins': ysResolve('src/common/mixins'),
        'components': ysResolve('src/common/components'),
        'helper': ysResolve('src/common/helper'),
        'images': ysResolve('src/images'),
        'dist': ysResolve('dist'),
        'flexible': ysResolve('src/utils/flexible'),
        'color-picker': ysResolve('src/common/components/color-picker'),
        'utils': ysResolve('src/utils'),
        'filters': ysResolve('src/filters'),
        'api': ysResolve('src/api'),
        '@@': ysResolve('src')
      }
    }
  }
}
